﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ExcelToOracle
{
    public partial class ImportSettingDialog : Form
    {
        private DataGridView _gridView;

        public ImportSettingDialog(DataGridView gridView)
        {
            InitializeComponent();

            _gridView = gridView;
        }

        private void _btnOK_Click(object sender, EventArgs e)
        {
            
            string[] names = textBox1.Text.Replace(Environment.NewLine ,string.Empty).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            

            foreach (DataGridViewColumn column in _gridView.Columns)
            {
                column.Visible = false;
                foreach (string name in names)
                {
                    if (column.HeaderText == name.Trim())
                    {
                        column.Visible = true;
                    }
                }
            }
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }
    }
}
